function moveToRightOrLeft(side, listLeftId, listRightId) {
    var listLeft = document.getElementById(listLeftId);
    var listRight = document.getElementById(listRightId);
    if (side == 1) {
        if (listLeft.options.length == 0) {
            alert('You have already moved all countries to Right');
            return false;
        } else {
            var selectedCountry = listLeft.options.selectedIndex;
            move(listRight, listLeft.options[selectedCountry].value, listLeft.options[selectedCountry].text);
            listLeft.remove(selectedCountry);
            if (listLeft.options.length > 0) {
                listLeft.options[0].selected = true;
            }
        }
    } else if (side == 2) {
        if (listRight.options.length == 0) {
            alert('You have already moved all countries to Left');
            return false;
        } else {
            var selectedCountry = listRight.options.selectedIndex;
            move(listLeft, listRight.options[selectedCountry].value, listRight.options[selectedCountry].text);
            listRight.remove(selectedCountry);
            if (listRight.options.length > 0) {
                listRight.options[0].selected = true;
            }
        }
    }
}

function move(listBoxTo, optionValue, optionDisplayText) {
    var newOption = document.createElement("option");
    newOption.value = optionValue;
    newOption.text = optionDisplayText;
    listBoxTo.add(newOption, null);
    return true;
}

function selectAll(listRightId) {
    var listRight = document.getElementById(listRightId);
    
    for (var i = 0; i < listRight.options.length; i++)
    {
        listRight.options[i].selected = true;
    }

    return true;
}